package com.atguigu.mycloud.service.impl;

import com.atguigu.mycloud.entities.Pay;
import com.atguigu.mycloud.mapper.PayMapper;
import com.atguigu.mycloud.service.PayService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 任浩
 * @version 1.0
 */
@Service
public class PayServiceImpl implements PayService {

    @Resource
    private PayMapper payMapper;

    public int add (Pay pay){
        System.out.println("添加操作");
       int num = payMapper.insert(pay);
       return num;
    }

    public int deletePay(int id){
        System.out.println("删除操作");
        //根据主键来进行删除
        int num = payMapper.deleteByPrimaryKey(id);
        return num;
    }

    public Pay getPay(int id){
        System.out.println("查找操作");
        //根据主键来进行查找数据
        Pay pay = payMapper.selectByPrimaryKey(id);
        return pay;
    }

    public int update(Pay pay){
        System.out.println("修改操作");
        int num = payMapper.updateByPrimaryKeySelective(pay);
        return num;
    }

    @Override
    public List<Pay> getInfo() {
        System.out.println("查询操作");
        List<Pay> list = payMapper.getinfo();
        return list;
    }
}
